package org.wsff.tools.api.gateway.impl;

import lombok.extern.slf4j.Slf4j;

import org.wsff.tools.api.gateway.core.monitor.AbstractGatewayMonitor;
import org.wsff.tools.api.gateway.core.monitor.GatewayMonitor;
import org.wsff.tools.api.gateway.core.monitor.Statistics;

/**
 * 框架提供的默认的网关监控器
 *
 * @author ryan
 * @version Id: DefaultGatewayMonitor.java, v 0.1 2022-04-01 16:33 ryan Exp $$
 */
@Slf4j
public class DefaultGatewayMonitor extends AbstractGatewayMonitor {

    public static GatewayMonitor instance() {
        return DefaultGatewayMonitorHolder.INSTANCE;
    }

    /**
     * 记录监控数据
     *
     * @param statistics 记录
     */
    @Override
    protected void record(Statistics statistics) {
        log.info(statistics.toString());
    }

    public static final class DefaultGatewayMonitorHolder {
        final static DefaultGatewayMonitor INSTANCE = new DefaultGatewayMonitor();
    }
}
